<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<link rel="stylesheet" href="../../css/animate.css">
		<link rel="stylesheet" href="../../iconfont/iconfont.css">
		<link rel="stylesheet" href="../../css/mescroll.css">
		<link rel="stylesheet" href="../../css/gloab.css">
		<title>广告详情</title>
		<style media="screen">
			.product-content {
				width: 100%;
				background: #e4e4e4;
				padding: 0.1rem 0;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<div id="public-header">
				<div id="statusbar"></div>
				<header class="public-header">
					<div class="public-header-lf iconfont icon-fanhui" @click="javascript:api.closeWin();"></div>
					<div class="public-header-title">广告详情</div>
				</header>
			</div>
			<!-- <div class="product-content" v-if="adDetail&&adDetail.length>0">
      <div style="width:94%;margin:auto;" v-html="adDetail">
      </div>
    </div> -->
			<div>
				<div class="product-category-list">
					<div class="product-category-list-son" style="box-shadow:none;">
						<div class="product-category-list-header flex wrap">
							<div class="product-category-list-header-lf" style="height:1.1rem;">
								<img :src="apiUrl1+info.user.avatar" alt="" v-if="info.user.avatar">
								<img src="../../image/public/touxiang.png" alt="" v-else>
								<label class="product-category-list-header-label">{{info.user.user_type}}</label>
							</div>
							<div class="product-category-list-header-rt">
								<div class="product-category-list-header-name flex wrap">
									<div class="product-category-list-header-name-lf" style="width:80%;overflow:hidden;height:0.45rem;">{{info.user.nickname}}</div>
								</div>
								<div class="product-category-list-header-name flex">
									<div class="guanggao-details-head-rt flex wrap">
										<div class="guanggao-details-head-rt-son">曝光次数：<span>{{info.view_count}}</span></div>
										<div class="guanggao-details-head-rt-son">微信号：<span>{{info.user.wechat}}</span></div>
										<div class="guanggao-details-head-rt-son">发布时间：<span>{{info.create_time}}</span></div>
										<div class="guanggao-details-head-rt-son">广告ID：<span>{{info.id}}</span></div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="guanggao-details-content">
					<div class="guanggao-details-content-text" v-html="info.content"></div>
					<div class="guanggao-details-content-imgs flex wrap" v-if="info.imgs&&info.imgs.length>0">
						<div class="guanggao-details-content-img" v-for="(items,index) in info.imgs">
							<img @click="seeImg(info,index)" :src="apiUrl1+items" alt="">
						</div>
					</div>
					<p class="auto">注：微信二维码请保存到相册再微信扫码<br>[联系我请备注<span style="color:#ff4747;">趣引流</span>看到的]</p>
				</div>
			</div>
			<!-- <div class="guanggao-details-page flex">
				<div class="guanggao-details-page-son F1">
					<img src="../../image/personal/guanggao_lf.png" alt="" @click="dec">
					<span>上一个</span>
				</div>
				<div class="guanggao-details-page-son F1">
					<img src="../../image/personal/guanggao_rt.png" alt="" @click="Inc">
					<span>下一个</span>
				</div>
			</div> -->
			<div class="guanggao-details-share flex wrap auto" style="margin-top:0.1rem;">
				<div class="guanggao-details-share-lf F2"></div>
				<div class="guanggao-details-share-text F1">分享至</div>
				<div class="guanggao-details-share-lf F2"></div>
			</div>
			<div class="guanggao-details-page auto" style="text-align:center;margin-top:0.2rem;padding-bottom:0.5rem;font-size:0.2rem;">
				<div class="guanggao-details-page-son" style="display:inline-block;margin-right:0.3rem;color:#404040;" @click="shares">
					<img src="../../image/personal/icon1.png" alt="">
					<span>微信</span>
				</div>
				<div class="guanggao-details-page-son" style="display:inline-block;color:#404040;" @click="share">
					<img src="../../image/personal/icon2.png" alt="">
					<span>朋友圈</span>
				</div>
			</div>
		</div>
		<div class="public-progress" style="z-index:9;">
			<img src="../../icon/icon150x150.png" alt="" class="animated infinite flash" style="width:200px;height:200px;display:block;margin:200px auto;">
		</div>
	</body>
	<script src="../../script/api.js"></script>
	<script src="../../script/jquery.js"></script>
	<script src="../../script/mescroll.js"></script>
	<script src="../../script/vue.js"></script>
	<script src="../../script/app.js"></script>
	<script src="../../script/jsencrypt.js"></script>
	<script src="../../script/fastclick.js"></script>

	<script>
		var vm;
		var mescroll;
		var mySwiper;
		apiready = function() {
			api.removeLaunchView();
			setBar("statusbar");
			setFont(750);
			startVue();
			$(".public-progress").fadeOut(1000);
			setTimeout(function() {
				$(".public-progress").css({
					"display": "none"
				});
			}, 1000);
		}

		function startVue() {
			vm = new Vue({
				el: "#app",
				data: {
					page: 0,
					pages: 0,
					info: [],
					num: '',
					adDetail: '',
				},
				created: function() {
					this.getAdInfo();
				},
				methods: {
					//获取分享赠送积分
					getIntegral: function() {
						api.ajax({
							url: apiUrl + 'api/home/getIntegral',
							method: 'post',
							data: {
								values: {
									uid: post_en($api.getStorage('uid')),
								},
							}
						}, function(ret, err) {
							if (ret.status) {
								alert(ret.msg);
							} else {
								alert(ret.msg);
							}
						});
					},
					adDetails: function() {
						api.ajax({
							url: apiUrl + 'api/Advertisement/adDetails',
							method: 'post',
							data: {
								values: {},
							}
						}, function(ret, err) {
							if (ret.status) {
								vm.adDetail = ret.data;
							} else {
								vm.adDetail = '';
							}
						});
					},
					//分享到好友
					shares: function() {
						var wxPlus = api.require('wxPlus');
						wxPlus.isInstalled(function(ret, err) {
							if (ret.installed) {
								var wxPlus = api.require('wxPlus');
								wxPlus.shareWebpage({
									apiKey: '',
									scene: 'session',
									// title: '最新项目',
									description: '最新项目 本条信息由趣引流平台推送，您也想自动引流，自动推广就下载吧。',
									thumb: 'widget://icon/logo.jpg',
									contentUrl: apiUrl + "/index.php/index/index/user?ids=" + JSON.stringify(vm.info[0]['ad_id']),
								}, function(ret, err) {
									if (ret.status) {
										vm.getIntegral();
									} else {
										// alert(err.code);
									}
								});
							} else {
								alert('当前设备未安装微信客户端');
							}
						});
					},
					//分享朋友圈
					share: function() {
						var wxPlus = api.require('wxPlus');
						wxPlus.isInstalled(function(ret, err) {
							if (ret.installed) {
								var wxPlus = api.require('wxPlus');
								wxPlus.shareWebpage({
									apiKey: '',
									scene: 'timeline',
									title: '广告详情',
									description: '本条信息由趣引流平台推送，您也想自动引流，自动推广就下载吧。',
									thumb: 'widget://icon/logo.jpg',
									contentUrl: apiUrl + "/index.php/index/index/user?ids=" + JSON.stringify(vm.info[0]['ad_id']),
								}, function(ret, err) {
									if (ret.status) {
										vm.getIntegral();
									} else {
										// alert(err.code);
									}
								});
							} else {
								alert('当前设备未安装微信客户端');
							}
						});
					},
					tzs: function() {
						api.openWin({
							name: 'page1',
							url: vm.info[0].url,
						});
					},
					seeImg: function(item, index) {
						var array = [];
						for (var i = 0; i < item.imgs.length; i++) {
							array.push(apiUrl1 + item.imgs[i]);
						}
						var photoBrowser = api.require('photoBrowser');
						photoBrowser.open({
							images: array,
							placeholderImg: 'widget://res/img/apicloud.png',
							bgColor: '#000'
						}, function(ret, err) {
							if(ret.eventType == 'longPress'){ save_img(array); }
							if (ret.eventType == 'click') {
								var photoBrowser = api.require('photoBrowser');
								photoBrowser.close();
							}
						});
						photoBrowser.setIndex({
							index: index
						});
					},
					dec: function() { //上一个
						if (this.page == 0) {
							api.toast({
								msg: '已经到顶了',
								duration: 2000,
								location: 'middle'
							});
							return;
						} else {
							this.page--;
							api.ajax({
								url: apiUrl + 'api/Advertisement/fenye',
								method: 'post',
								data: {
									values: {
										page: this.page,
										showpage: 1,
									},
								}
							}, function(ret, err) {
								if (ret.status) {
									vm.info = ret.data;
								} else {
									vm.info = ret.data;
								}
							});
						}
					},
					Inc: function() { //下一个
						if (vm.num <= vm.page + 1) {
							api.toast({
								msg: '已是最后一条数据了',
								duration: 2000,
								location: 'middle'
							});
							return;
						}
						if (this.info == "") {
							return;
						} else {
							this.page++;
							api.ajax({
								url: apiUrl + 'api/Advertisement/fenye',
								method: 'post',
								data: {
									values: {
										page: this.page,
										showpage: 1,
									},
								}
							}, function(ret, err) {
								if (ret.status) {
									vm.info = ret.data;
									if (vm.info[0]['createtime'] == 0) {
										vm.adDetails();
									} else {
										vm.adDetail = '';
									}
								} else {
									api.toast({
										msg: ret.msg,
										duration: 2000,
										location: 'middle'
									});
									vm.info = ret.data;
								}
							});
						}
					},
					getAdInfo: function() {
						var self = this;
						var id = api.pageParam['id'];
						api.ajax({
							url: apiUrl + '/api/index/adDetail',
							method: 'post',
							data: {
								values: {
									id: id
								},
							}
						}, function(ret, err) {
							if (ret.code == 1) {
								vm.info = ret.data;
								console.log(JSON.stringify(vm.info))
								/* if (vm.info[0]['createtime']==0) {
								  vm.adDetails();
								}else{
								  vm.adDetail = '';
								} */
							} else {
								vm.info = ret.data;
							}
						});
					},
				}
			})
		}
	</script>
</html>
